<?php

namespace app\backend\controller;
use app\backend\model\ZhCurrencySetu as ZhCurrencySetuModel;
class ZhCurrencySetu extends Admin
{
    public function index()
    {
        if (!$this->request->isAjax()) {
            $res = ZhCurrencySetuModel::where([
                'wxapp_id' => session('backend.wxapp_id')
            ])->find();
            $this->view->assign('info', $res);
            return view('index');
        }
    }

    public function update()
    {
        $id      = $this->request->param('id', '', 'serach_in');
        $vip_url = $this->request->param('vip_url', '', 'serach_in');
        $hx_url = $this->request->param('hx_url', '', 'serach_in');
        $hy_url= $this->request->param('hy_url', '', 'serach_in');
        $top_url= $this->request->param('top_url', '', 'serach_in');
        $hx_name= $this->request->param('hx_name', '', 'serach_in');
        $top_name=$this->request->param('top_name', '', 'serach_in');
        $xs_name=$this->request->param('xs_name', '', 'serach_in');
        $hytq=$this->request->param('hytq', '', 'serach_in');
        $mflr=$this->request->param('mflr', '', 'serach_in');
        $xqhd=$this->request->param('xqhd', '', 'serach_in');
        $zshx=$this->request->param('zshx', '', 'serach_in');
        $zshnfw=$this->request->param('zshnfw', '', 'serach_in');
        $hxcz=$this->request->param('hxcz', '', 'serach_in');
        $wdzd=$this->request->param('wdzd', '', 'serach_in');


        ZhCurrencySetuModel::where([
            'wxapp_id' => session('backend.wxapp_id'),
            'id'       => $id
        ])->update([
            'updatetime' => time(),
            'vip_url' => $vip_url,
            'hx_url'    => $hx_url,
            'hy_url'    => $hy_url,
            'top_url'    => $top_url,
             'hx_name'    => $hx_name,
            'top_name'=>$top_name,
            'xs_name'=>$xs_name,
            'hytq'=>$hytq,
            'mflr'=>$mflr,
            'xqhd'=>$xqhd,
            'zshx'=>$zshx,
            'zshnfw'=>$zshnfw,
            'wdzd'=>$wdzd,
            'hxcz'=>$hxcz
        ]);
        return json(['status' => '00', 'msg' => '保存成功']);
    }
}